import sim
sim.getStatus()

import checkNet
checkNet.waitNetworkReady(timeout)

# -*- coding: utf-8 -*-
import sim
import checkNet

'''
下面两个全局变量是必须有的，用户可以根据自己的实际项目修改下面两个全局变量的值
'''
PROJECT_NAME = "QuecPython_TencentYun_example"
PROJECT_VERSION = "1.0.0"

def SIM_Init():
    r=sim.getStatus()
    if r==1:
        print("SIM init OK")
       
    else:
        print("SIM init failed",r)
    return r

def Net_Init():
    checknet = checkNet.CheckNetwork(PROJECT_NAME, PROJECT_VERSION)
    stagecode, subcode = checknet.wait_network_connected(30)
    if stagecode == 3 and subcode == 1:
        print('Network connection successful!')
        return 1
    else:
        print('Network connection failed! stagecode = {}, subcode = {}'.format(stagecode, subcode))
        return 0

def Internet_Init():
    r=SIM_Init()
    if r==1:
        if Net_Init():
            return 1
        else:
            return 0
    else:
        return 0

